
package crud;

import apijson.Log;
import apijson.framework.APIJSONApplication;
import apijson.framework.APIJSONCreator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;


@Slf4j
@SpringBootApplication
public class Application {

    private static ApplicationContext APPLICATION_CONTEXT;

    public static ApplicationContext getApplicationContext() {
        return APPLICATION_CONTEXT;
    }


    public static void main(String[] args) throws Exception {
        APPLICATION_CONTEXT = SpringApplication.run(Application.class, args);

        Log.DEBUG = false;
        APIJSONApplication.init(false);
    }

    static {
        APIJSONApplication.DEFAULT_APIJSON_CREATOR = new APIJSONCreator<Long>() {
            @Override
            public SQLConfig createSQLConfig() {
                return new SQLConfig();
            }

            @Override
            public SQLExecutor createSQLExecutor() {
                return new SQLExecutor();
            }
        };
    }
}
